// 纯函数和不纯的函数
// slice / splice

let array = [1,2,3,4,5]


//纯函数
console.log(array.slice(0,3)) //截取三个元素，取2会截取两个，取不到三个
console.log(array.slice(0,3))
console.log(array.slice(0,3))

//不纯的函数
console.log(array.splice(0,3))
console.log(array.splice(0,3))
console.log(array.splice(0,3))

//纯函数
function getSum (n1,n2){
  return n1+n2
}
console.log(getSum(1,2))
console.log(getSum(1,2))
console.log(getSum(1,2))
